package org.yzh.web.business.kafka.kafkaDTO;

import com.alibaba.fastjson.annotation.JSONField;
import org.yzh.protocol.t808.T0200;
import org.yzh.web.business.utils.DateTimeUtils;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * description:位置信息 发送到kafka中的 数据结构
 * author: gwd
 **/
public class Position4kafka implements Serializable {

    //车牌号码
    @JSONField(name = "p")
    private String plate;

    //车牌颜色
    @JSONField(name = "pc")
    private int plateColor;

    //车辆编号
    @JSONField(name = "ti")
    private int truckId;

    //公司id
    @JSONField(name = "ci")
    private int companyId;
    //--------------------------------------------------
    //公司id
    @JSONField(name = "ai")
    private int agentId;

    //该车辆的设备 imei号
    @JSONField(name = "i")
    private String imei;

    //定位时间戳
    @JSONField(name = "gt")
    private long gpsTime;

    //上点时间
    @JSONField(name = "ut")
    private long upTime;

    //gps经度值
    private double lon;

    //gps纬度值
    private double lat;

    //速度 km/h
    @JSONField(name = "sp")
    private int speed;

    //终端速度
    @JSONField(name = "tp")
    private int termSpeed;

    //方向
    @JSONField(name = "d")
    private int direction;

    //海拔高度，单位为米（m）
    @JSONField(name = "alt")
    private int altitude;

    @JSONField(name = "dvt")
    private int deviceType;

    //数据类型 默认0正常点  1补点
    @JSONField(name = "dt")
    private int dataType = 0;

    //异常点
    @JSONField(name = "err")
    private boolean errorFlag = false;

    //车辆所在区域id
    @JSONField(name = "ari")
    private int areaId;

    //报警标志位
    @JSONField(name = "ws")
    private long warnStatus;

    //状态
    @JSONField(name = "s")
    private long status;

    //是否离线
    private boolean offline = false;

    //报警标志扩展位
    @JSONField(name = "wse")
    private String warnStatusEx;


    @JSONField(name = "lc")
    private int licenseCity;

    @JSONField(name = "ts")
    private String tranScope;//经营范围

    @JSONField(name = "tss")
    private String tranSubScope;//经营子范围

    @JSONField(name = "drt")
    private int driveType;//0- 单驾1-双驾2-多驾

    @JSONField(name = "tl")
    private Integer typeLocation; //设备包含功能: 定位 0 未选择  1选择

    @JSONField(name = "sq")
    private Integer signal = 0; //无线通信网络信号强度

    @JSONField(name = "gn")
    private Integer gnss = 0; // gnss 卫星数量

    @JSONField(name = "sri")
    private Integer sourceId = 0;    //网关自身的id，用来区分车辆是由哪个网关上传的

    private List<Object> lastList; //前面的点列表   private List<LastTrack> lastList;

    @JSONField(name = "add")
    private Map<Integer, Object> addInfo;   // 位置附加信息项

    //------------------------------------------------------------------------------------------------------------------

    public String getPlate() {
        return plate;
    }

    public void setPlate(String plate) {
        this.plate = plate;
    }

    public int getPlateColor() {
        return plateColor;
    }

    public void setPlateColor(int plateColor) {
        this.plateColor = plateColor;
    }

    public int getTruckId() {
        return truckId;
    }

    public void setTruckId(int truckId) {
        this.truckId = truckId;
    }

    public int getCompanyId() {
        return companyId;
    }

    public void setCompanyId(int companyId) {
        this.companyId = companyId;
    }

    public int getAgentId() {
        return agentId;
    }

    public void setAgentId(int agentId) {
        this.agentId = agentId;
    }

    public String getImei() {
        return imei;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public long getGpsTime() {
        return gpsTime;
    }

    public void setGpsTime(long gpsTime) {
        this.gpsTime = gpsTime;
    }

    public long getUpTime() {
        return upTime;
    }

    public void setUpTime(long upTime) {
        this.upTime = upTime;
    }

    public double getLon() {
        return lon;
    }

    public void setLon(double lon) {
        this.lon = lon;
    }

    public double getLat() {
        return lat;
    }

    public void setLat(double lat) {
        this.lat = lat;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public int getTermSpeed() {
        return termSpeed;
    }

    public void setTermSpeed(int termSpeed) {
        this.termSpeed = termSpeed;
    }

    public int getDirection() {
        return direction;
    }

    public void setDirection(int direction) {
        this.direction = direction;
    }

    public int getAltitude() {
        return altitude;
    }

    public void setAltitude(int altitude) {
        this.altitude = altitude;
    }

    public int getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(int deviceType) {
        this.deviceType = deviceType;
    }

    public int getDataType() {
        return dataType;
    }

    public void setDataType(int dataType) {
        this.dataType = dataType;
    }

    public boolean isErrorFlag() {
        return errorFlag;
    }

    public void setErrorFlag(boolean errorFlag) {
        this.errorFlag = errorFlag;
    }

    public int getAreaId() {
        return areaId;
    }

    public void setAreaId(int areaId) {
        this.areaId = areaId;
    }

    public long getWarnStatus() {
        return warnStatus;
    }

    public void setWarnStatus(long warnStatus) {
        this.warnStatus = warnStatus;
    }

    public long getStatus() {
        return status;
    }

    public void setStatus(long status) {
        this.status = status;
    }

    public boolean isOffline() {
        return offline;
    }

    public void setOffline(boolean offline) {
        this.offline = offline;
    }

    public String getWarnStatusEx() {
        return warnStatusEx;
    }

    public void setWarnStatusEx(String warnStatusEx) {
        this.warnStatusEx = warnStatusEx;
    }

    public int getLicenseCity() {
        return licenseCity;
    }

    public void setLicenseCity(int licenseCity) {
        this.licenseCity = licenseCity;
    }

    public String getTranScope() {
        return tranScope;
    }

    public void setTranScope(String tranScope) {
        this.tranScope = tranScope;
    }

    public String getTranSubScope() {
        return tranSubScope;
    }

    public void setTranSubScope(String tranSubScope) {
        this.tranSubScope = tranSubScope;
    }

    public int getDriveType() {
        return driveType;
    }

    public void setDriveType(int driveType) {
        this.driveType = driveType;
    }

    public Integer getTypeLocation() {
        return typeLocation;
    }

    public void setTypeLocation(Integer typeLocation) {
        this.typeLocation = typeLocation;
    }

    public Integer getSignal() {
        return signal;
    }

    public void setSignal(Integer signal) {
        this.signal = signal;
    }

    public Integer getGnss() {
        return gnss;
    }

    public void setGnss(Integer gnss) {
        this.gnss = gnss;
    }

    public Integer getSourceId() {
        return sourceId;
    }

    public void setSourceId(Integer sourceId) {
        this.sourceId = sourceId;
    }

    public List<Object> getLastList() {
        return lastList;
    }

    public void setLastList(List<Object> lastList) {
        this.lastList = lastList;
    }

    public Map<Integer, Object> getAddInfo() {
        return addInfo;
    }

    public void setAddInfo(Map<Integer, Object> addInfo) {
        this.addInfo = addInfo;
    }

    public Position4kafka() {
    }

    public Position4kafka(T0200 t0200) {
        // 目前只对：1.经纬度 ， 2.速度 做了处理 push 到 kafka
        // 终端手机号
        this.setImei(t0200.getClientId());
        //报警标志 位
        this.setWarnStatus(t0200.getWarnBit());
        //状态 位
        this.setStatus(t0200.getStatusBit());
        // 经纬度 + 高程
        this.setLon(t0200.getLongitude() / 1000000D);
        this.setLat(t0200.getLatitude() / 1000000D);
        this.setAltitude(t0200.getAltitude());
        // 速度 单位km/h
        this.setSpeed(t0200.getSpeed() / 10);
        //方向
        this.setDirection(t0200.getDirection());
        // 终端定位时间
        this.setGpsTime(DateTimeUtils.toTimestamp(t0200.getDateTime(), "yyMMddHHmmss"));
        // 位置附加信息项
        this.setAddInfo(t0200.getAttributes());
    }
}
